/**
 * Copyright 2017 orivil Authors. All rights reserved.
 * Use of this source code is governed by a MIT-style
 * license that can be found at https://mit-license.org.
 */

package mux

type Middleware interface {

	Serve(ctx *Context)
}

type MiddlewareCondition func(act *Action) bool

// Each name must correspond to a security scheme which is declared in the Security Definitions.
// If the security scheme is of type "oauth2", then the value is a list of scope names required
// for the execution. For other security scheme types, the array MUST be empty.
type SecurityRequirement map[string][]string

type BeforeHandler func(ctx *Context)

func (ch BeforeHandler) Serve(ctx *Context) {
	ch(ctx)
}

type AfterHandler func(ctx *Context)

func (ch AfterHandler) Serve(ctx *Context) {
	ch(ctx)
}

type Security struct {
	Requirement SecurityRequirement
	Handler func(ctx *Context)
}

func (sh *Security) Serve(ctx *Context) {

	sh.Handler(ctx)
}

